import { gql } from 'apollo-server-koa';

export const typeDefs = gql`
  type User {
    id: ID!
    name: String! 
    email: String!
    school: School
  }

  type School {
    id: ID!
    name: String!
    users: [User!]!
  }

  type Query {
    users: [User!]!
    user(id: ID!): User
    schools: [School!]!
    school(id: ID!): School
  }

  type Mutation {
    createUser(name: String!, email: String!, schoolId: ID): User!
    updateUser(id: ID!, name: String, email: String, schoolId: ID): User
    deleteUser(id: ID!): User
    createSchool(name: String!): School!
    updateSchool(id: ID!, name: String): School
    deleteSchool(id: ID!): School
  }
`;